package com.java.tutorials.spring.basicdatasource;

import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationContext;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;

import javax.sql.DataSource;

/**
 * Created by xuzhike on 2016/1/30.
 */
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(locations={"classpath*:Spring-ApplicationContext.xml"})
public class BasicDataSourcefromapacheTest {
    @Autowired
    public ApplicationContext ctx;

    @Test
    public void test(){
        DataSource ds = (DataSource) ctx.getBean("dataSource");
        System.out.println(ds);
        BasicDataSourcefromapache ws = (BasicDataSourcefromapache) ctx.getBean("employeeDao");
    }
}
